package Image;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Random;

/**
 * description:太极
 * author:zcx
 * lenovo
 * 时间：2022.01.23.19.00
 */
public class Img4 {
    public static void main(String[] args) throws IOException {
        var w=800;
        var h=800;
        var t=2;
        var i=new BufferedImage(w,h,t);
        var g=i.createGraphics();
        //
        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
        //g.setStroke(new BasicStroke(5));
        g.setColor(Color.ORANGE);
        g.fillRect(0,0,w,h);

        g.setColor(Color.WHITE);
        g.fillArc(200,200,400,400,90,180);

        g.setColor(Color.BLACK);
        g.fillArc(200,200,400,400,-90,180);

        g.fillOval(300,200,200,200);
        g.setColor(Color.WHITE);
        g.fillOval(300,400,200,200);
        g.fillOval(350,250,100,100);
        g.setColor(Color.BLACK);
        g.fillOval(350,450,100,100);
//干扰线
//        Random r=new Random();
//        for (int i1 = 0; i1 < 15; i1++) {
//            g.setStroke(new BasicStroke(r.nextInt(5)+1));
//            g.setColor(new Color(r.nextInt(256),r.nextInt(256),r.nextInt(256)));
//            int x1=r.nextInt(w);
//            int x2=r.nextInt(w);
//            int y1=r.nextInt(h);
//            int y2=r.nextInt(h);
//            g.drawLine(x1,y1,x2,y2);
//        }
        for (int i1 = 0; i1 < 100; i1++) {
            int x1=i1*10+3;
            int x2=x1+5;
            int y=400;
            g.drawLine(x1,y,x2,y);
        }

        for (int i1 = 0; i1 < 100; i1++) {
            int y1=i1*10+3;
            int y2=y1+5;
            int x=400;
            g.drawLine(x,y1,x,y2);
        }

        g.dispose();
        ImageIO.write(i,"png",new File("i2.png"));
    }
}
